package study;

import java.util.Random;

/**
 * 具体的策略
 */
public class WinningStrategy implements Strategy{

    /**
     * 随机数生成器
     */
    private Random random;

    /**
     * 上一局的输赢结果
     */
    private boolean won = false;

    /**
     * 上一局的手势
     */
    private Hand prevHand;

    public WinningStrategy(int seed){
        random = new Random(seed);
    }

    public Hand nextHand() {
        if(!won){
            return Hand.getHand(random.nextInt(3));
        }
        return prevHand;
    }

    public void study(boolean win) {
        this.won = win;
    }
}
